import { Resolver, Query, Args } from '@nestjs/graphql';
import { SpecialService } from './special.service';

@Resolver('Special')
export class SpecialResolver {

  constructor(private readonly specialService: SpecialService) {}

  @Query('special')
  async getspecial(@Args('id') id: number) {
    return this.specialService.findOneById(id);
  }

  @Query('specials')
  async getspecials(@Args() args: { page: number, pageSize: number }) {
    const { page = 1, pageSize = 20 } = args;
    const result = this.specialService.findWithPagination(page, pageSize);
    return result;
  }
}
